package com.guoqing.example.web;

import com.guoqing.example.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class ThymeleafController {

    @RequestMapping("/thymeleaf")
    public String helloThymeleaf(Model model) {
        model.addAttribute("msg", "hello Thymeleaf！");
        List<User> users = new ArrayList<>();
        users.add(new User("A01", "张三", "男", 10));
        users.add(new User("A02", "李四", "女", 11));
        users.add(new User("A03", "王五", "男", 12));
        users.add(new User("A04", "赵六", "女", 13));
        users.add(new User("A05", "孙七", "男", 14));
        model.addAttribute("users", users);
        return "hello";
    }
}
